export default (url, method, params) => {
	// 从本地存储中获取token
	let token = uni.getStorageSync('token');
	// let Link = 'http://192.168.1.14:8888/jeecg-boot';
	// let Link = 'http://192.168.1.142:8888/jeecg-boot';
	// let Link = 'http://192.168.1.146:8888/jeecg-boot'; //仇 
	// let Link = 'https://sys.shengezhihuan.com/jeecg-boot';
	let Link = 'https://hot.guanggaoduo.cn/ad-hot';
	getApp().globalData.url = Link
	return new Promise((resolve, reject) => {
		uni.request({
			url: Link + url,
			method: method,
			header: {
				'X-Access-Token': token,
			},
			data: {
				...params
			},
			success(res) {
				if (res.statusCode == 401) {
					// uni.showToast({
					// 	title: res.data.message,
					// 	icon: 'none'
					// })
					// setTimeout(() => {
					// 	uni.clearStorageSync();
					// 	uni.switchTab({
					// 		url: '/pages/menu/menu'
					// 	})
					// }, 1000)
				}
				resolve(res.data);
			},
			fail(err) {
				reject(err);
				console.log(err, 111111);
			},
			complete() {
				// ...
			}
		});
	});
};